<template>
	<view>
		<u-sticky :offset-top="offsetTop" :enable="enable">
			<view class="top">
				<view class="up">
					<view class="list l1">
						<image src="../static/z3.png" mode=""></image>
						<view class="name">
							持有总量(Fmb)
						</view>
						<view class="number">
							{{info.hold_all}}
						</view>
					</view>
					<view class="list l2" v-if="current==0">
						<image src="../static/z4.png" mode=""></image>
						<view class="name">
							预计产出(Fmb)
						</view>
						<view class="number">
							{{info.now_right_number}}
						</view>
					</view>
					<view class="list l2" v-else-if="current==1">
						<image src="../static/z4.png" mode=""></image>
						<view class="name">
							实际产出(Fmb)
						</view>
						<view class="number">
							{{info.wait_right_number}}
						</view>
					</view>
					<view class="list l2" v-else>
						<image src="../static/z4.png" mode=""></image>
						<view class="name">
							累计产出(Fmb)
						</view>
						<view class="number">
							{{info.ready_right_number}}
						</view>
					</view>
				</view>
				<view class="down">
					<u-tabs ref="tabs" @change="change" :current="current" activeColor="#FB683D" inactiveColor="#333333"
						bgColor="transparent" height="100" :list="list2" :is-scroll="false">
					</u-tabs>
				</view>
			</view>
		</u-sticky>
		<view class="content">
			<view class="menu" v-if="current==1">
				<view class="right" @click="banOnsaleList">
					挂卖提示 <image src="../static/x1.png" mode=""></image>
				</view>
			</view>
			<view v-if="list.length>0">
				<view class="list" v-if="item.show" v-for="(item,index) in list" :key="index">
					<view class="title">
						<view class="left">
							<image :src="img_pre+ item.manor_logo"></image>
							<view class="name">
								{{item.title}}
							</view>
						</view>
						<view class="id">
							<view>
								{{item.time}}
							</view>
						</view>
					</view>
					<view class="up">
						<view class="right">
							<view class="number font">
								{{item.output}} <text>Fmb</text>
							</view>
							<view class="name">
								{{current==2?'实际产出':(current==1?'已经产出':'即将产出')}}
							</view>
						</view>
						<view class="left">
							<view class="auto" v-if="current!=2">
								<view class="name">
									当前价值
								</view>
								<view class="text" style="color:#205FFA;">
									{{item.price}}<text>Fmb</text>
								</view>
							</view>
							<view class="auto" v-if="current==2">
								<view class="name">
									交易价值
								</view>
								<view class="text" style="color:#205FFA;">
									{{item.price}}<text>Fmb</text>
								</view>
							</view>
							<view class="auto">
								<image src="../static/z6.png" class="img"></image>
								<view class="time">
									{{item.pid}}
								</view>
							</view>
							<view class="auto" v-if="current==0">
								<image src="../static/z5.png" class="img"></image>
								<view class="name">
									产出天数
								</view>
								<view class="text">
									{{item.day}}<text>天</text>
								</view>
							</view>
							<view class="auto" v-if="current==1">
								<image src="../static/z5.png" class="img"></image>
								<view class="name">
									处理时间
								</view>
								<view class="text">
									{{item.time_count}}<text>天</text>
								</view>
							</view>
							<view class="auto" v-if="current==2">
								<image v-if="item.onsale_by_gdbticket ==0" src="../static/z5.png" class="img"></image>
								<image v-else src="../static/z7.png" class="img"></image>
								<view class="name">
									蜂巢状态
								</view>
								<view class="text" v-if="item.onsale_by_gdbticket ==0">
									<text style="font-size: 30rpx;">{{item.text}}</text>
								</view>
								<view class="text" v-if="item.type =='SELL_OUT'&&item.onsale_by_gdbticket!=0">
									<text style="font-size: 30rpx;">{{item.text}}</text>
								</view>
								<view class="text" v-if="item.type=='ONSALE'&&item.onsale_by_gdbticket!=0">
									<text style="font-size: 30rpx;">金蜜券挂卖</text>
								</view>
							</view>
						</view>
					</view>
					<view class="down" v-if="item.super_operate!=1">
						<button type="default" v-if="item.type=='DECOMPOSE_GOODS'" @click="getfenjieGoods(index,item)">
							<image src="../static/u5.png" mode=""></image>分解
						</button>
						<button type="default" v-if="item.type=='DECOMPOSE_GOODS'" style="margin-left: 24rpx;"
							@click="getreminder(index,item)">
							<image src="../static/u4.png" mode=""></image>挂卖
						</button>
						<button type="default" v-if="item.type=='DECOMPOSE_GOODS'" style="margin-left: 24rpx;"
							@click="getHarvest(index,item)">
							<image src="../static/u3.png" mode=""></image>收获
						</button>
            <button type="default" v-if="item.type=='WIN_PRICE'"
                    @click="checkSafePasswordEmpty('goldSale',item,1)">
              <image src="../static/u4.png" mode=""></image>金蜜券挂卖
            </button>
            <button type="default" v-if="item.type=='WIN_PRICE'" style="margin-left: 24rpx;"
                    @click="checkSafePasswordEmpty('reward',item,1)">
              <image src="../static/award.png" mode=""></image>领奖
            </button>
						<button type="default" v-if="item.type=='HOLD_PRODUCED'&&item.fen_reduce_status==1"
							@click="getExchange(index,item)">
							拆分
						</button>
						<button type="default" v-if="item.type=='HOLD_PRODUCED'&&item.jie_reduce_status==1"
							@click="getChange(index,item)">
							拆解
						</button>
						<button type="default" v-if="item.type=='HOLD_PRODUCED'" @click="getCode(index,item)">
							<image src="../static/u4.png" mode=""></image>挂卖
						</button>
						<button type="default" v-if="item.type=='HOLD_INITIAL'" @click="getCodeInitial(index,item)">
							<image src="../static/u4.png" mode=""></image>挂卖
						</button>
						<button type="default" v-if="item.type=='FULL_AMOUNT'"
							@click="getApplySplit(index,item)">拆分</button>
						<button type="default" v-if="item.type=='FULL_AMOUNT'&&false" style="margin-left: 24rpx;"
							@click="getHarvest(index,item)">兑换蜂钻</button>
						<button type="default" v-if="item.type=='FULL_AMOUNT'" style="margin-left: 24rpx;"
							@click="getHarvest(index,item)">
							<image src="../static/u3.png" mode=""></image>收获
						</button>
						<button type="default" v-if="item.type=='HOLD_PRODUCED'" style="margin-left: 24rpx;"
							@click="getHarvest(index,item)">
							<image src="../static/u3.png" mode=""></image>收获
						</button>
						<button type="default" v-if="item.type=='TAKE_DELIVERY_MANUAL'&&item.address_finish==1"
							@click="getLogistics(index,item)" style="">查看物流</button>
						<button type="default" v-if="item.type=='TAKE_DELIVERY_AUTO'&&item.address_finish==1"
							@click="getLogistics(index,item)" style="">查看物流</button>
						<button type="default" v-if="item.type=='WAIT_ADMIN_HANDLE'" style="">等待收获</button>
						<button type="default" v-if="item.type=='TAKE_DELIVERY_AUTO'&&item.address_finish==0"
							@click="id=index,json=item,addSite=true" style="">添加地址</button>
						<button type="default" v-if="item.type=='TAKE_DELIVERY_AUTO'&&item.address_finish==0"
							@click="id=index,json=item,appeal=true" style="margin-left: 24rpx;">申诉</button>
						<button type="default" v-if="item.type=='EXCHANGE_HOLD_INITIAL'"
							@click="getExchangeGoodsCash(index,item)">金蛋</button>
					</view>
				</view>
			</view>
			<view class="none" v-else>
				<view class="none-view">
					<image src="../../../static/image/none.png" class="none-image"></image>
					<view class="none-name">
						暂无相关数据~
					</view>
				</view>
			</view>
		</view>
		<image src="../static/fruits.png" class="fruits" v-if="current==2" @click="toPage('fruits')">
		</image>
		<u-popup v-model="appeal" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="logistics">
				<view class="popup_top"></view>
				<view class="_view">
					<view class="title">
						申诉
					</view>
					<view class="appeal">
						因超过产出时间12小时，该蜂巢
					</view>
					<view class="appeal">
						已自动收获，是否确认申诉
					</view>
				</view>
				<button type="default" class="button" @click="checkSafePasswordEmpty('appeal')">确认申诉</button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="logistics" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="logistics">
				<view class="popup_top"></view>
				<view class="_view">
					<view class="title">
						物流信息
					</view>
					<view class="logistics-content">
						<view class="list" v-for="(item,index) in logisticsList" :key="index">
							<view class="icon"></view>
							<view class="right">
								<view>
									快递公司:{{item.company}}
								</view>
								<view>
									快递单号:{{item.number}}
								</view>
								<view>
									发出时间:{{item.createtime}}
								</view>
							</view>
						</view>
					</view>
				</view>
				<button type="default" class="button" @click="logistics=false">我知道了</button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="harvest" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="harvest">
				<view class="popup_top"></view>
				<view class="_view">
					<view class="title">
						收获
					</view>
					<view class="text">
						您的蜂巢是{{json.title}}，当前价值
					</view>
					<view class="number font">
						{{json.price}} <text>蜜贝</text>
					</view>
					<view class="select" @click="abc">
						<view class="da omit">
							{{label}}
						</view>
						<view class="xiao">></view>
					</view>
				</view>
				<button type="default" class="button" @click="checkSafePasswordEmpty('getharvest')">确认收获</button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
    <u-popup v-model="award" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
      <view class="harvest">
        <view class="popup_top"></view>
        <view class="_view">
          <view class="title">
            恭喜您
          </view>
          <view class="reward-Star">
            <image class="img" src="../static/rewardStar.png"></image>
            <view class="text">
              您已获得奖励
            </view>
          </view>
        </view>
        <button type="default" class="button" @click="award = false">我知道了</button>
        <view class="popup_top"></view>
      </view>
    </u-popup>
		<u-popup v-model="addSite" :closeable="true" borderRadius="10" mode="center">
			<view class="harvest">
				<view class="popup_top"></view>
				<view class="_view">
					<view class="title">
						选择地址
					</view>
					<view class="select" @click="abc">
						<view class="da omit">
							{{label}}
						</view>
						<view class="xiao">></view>
					</view>
				</view>
				<button type="default" class="button" @click="checkSafePasswordEmpty('appendAddress')">确认</button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="Hang" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="harvest">
				<view class="popup_top"></view>
				<view class="_view">
					<view class="title">
						挂卖
					</view>
					<view class="text">
						您的蜂巢是{{json.title}}，当前价值
					</view>
					<view class="number font" v-if="json.type=='HOLD_PRODUCED'||json.type=='DECOMPOSE_GOODS'">
						{{json.price}} <text>蜜贝</text>
					</view>
					<view class="number font" v-else>
						{{add(json.price,json.output)}} <text>蜜贝</text>
					</view>
				</view>
				<button type="default" class="button" @click="checkSafePasswordEmpty('doSale')">确认挂卖</button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-select v-model="site" :list="list1" @confirm="confirm"></u-select>
		<u-keyboard mode="number" :dot-enabled="false" v-model="pay" :tooltip="false" @change="onChange"
			@backspace="onBackspace">
			<view>
				<view class="u-text-center">
					<view class="u-text-name">
						二级密码
					</view>
					<view class="u-text-text">
						您当前正在进行交易，为确保账户安全请输入二级 密码验证身份
					</view>
				</view>
				<view class="u-flex u-row-center">
					<u-message-input mode="box" :maxlength="6" :dot-fill="true" v-model="password"
						:disabled-keyboard="true"></u-message-input>
				</view>
				<view class="u-text-center u-padding-top-10 u-padding-bottom-20 tips"></view>
			</view>
		</u-keyboard>
		<u-popup borderRadius="10" close-icon-pos="top-left" :closeable="true" mode="bottom" v-model="code">
			<view class="popup">
				<view class="_view">
					<view class="title">
						上传收款码
					</view>
					<view class="cont">
						<view class="name">
							您还未上传收款码，不上传将 影响您的后续操作，请尽快上传
						</view>
					</view>
					<view class="code">
						<image src="../../../static/image/code.png"></image>
					</view>
				</view>
				<u-button type="success" @click="toPage('/pages/htmlA/setting/collection')" :ripple="true"
					class="button">立即前往</u-button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="red" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="harvest">
				<view class="_view">
					<view class="title">
						挂卖提示
					</view>
					<view class="date" v-for="(item,index) in banOnsale" :key="index">
						{{formatSeconds(item.second_start)+"-"+formatSeconds(item.second_end)}}
					</view>
					<view class="text">
						时间段内不可挂卖蜂巢
					</view>
				</view>
				<button type="default" class="button" @click="red=false">确认</button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="exchange" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="popup">
				<view class="popup_top"></view>
				<view class="_view">
					<view class="title">
						拆分
					</view>
					<view class="cont">
						<view class="name" style="font-size: 32rpx; color: #333333;font-weight: bold;">
							请输入拆分蜂巢价值
						</view>
						<view class="text"
							style="font-size: 24rpx; color: #666666;padding: 0 70rpx;display: inherit;line-height: 40rpx;">
							*蜂巢拆分成两个蜂巢输入价值自动计算输入值 <text style="color: #FEC31D;font-size: 24rpx;">不小于50</text>
						</view>
					</view>
					<view class="input">
						<view class="list">
							<input type="number" v-model="input1" :disabled="true">
						</view>
						<text>+</text>
						<view class="list" style="background: #BDC3D3;color: #CECED0;">
							<input type="number" v-model="input2" :disabled="true">
						</view>
					</view>
				</view>
				<button type="default" class="button"
					@click="exchange=false,checkSafePasswordEmpty('exchange')">确认</button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="goodsChange" :closeable="true" borderRadius="10" mode="center">
			<view class="popup">
				<view class="popup_top"></view>
				<view class="_view">
					<view class="title">
						拆解
					</view>
					<view class="cont">
						<view class="name" style="font-size: 32rpx; color: #333333;font-weight: bold;">
							请选择拆解方式
						</view>
						<u-radio-group v-model="likeFruit" @change="checkboxGroupChange" :width="radioCheckWidth"
							:wrap="radioCheckWrap">
							<view class="radio">
								<view class="list" v-for="(item, index) in checkboxList" :key="index">
									<u-radio shape="circle" :disabled="item.disabled" activeColor="#FFC31E"
										class="checkbox" v-model="item.checked" :name="item.type"></u-radio>
									<view class="user">
										<view class="name">
											蜂巢
										</view>
										<text>+</text>
										<view class="text">
											{{item.name}}
										</view>
									</view>
								</view>
							</view>
						</u-radio-group>
					</view>
					<view class="cont">
						<view class="name" style="font-size: 32rpx; color: #333333;font-weight: bold;">
							请输入拆解蜂巢价值
						</view>
						<view class="text"
							style="font-size: 24rpx; color: #666666;padding: 0 70rpx;display: inherit;line-height: 40rpx;">
							*剩余价值按选择方式以<br> <text
								style="color: #FEC31D;font-size: 24rpx;">蜂巢+{{likeFruit==1?'蜜贝':'金蜜'}}</text>的 <text
								style="color: #FEC31D;font-size: 24rpx;">{{checkboxList[likeFruit-1].scale}}</text>倍返还
						</view>
					</view>
					<view class="input">
						<view class="list">
							<input type="number" v-model="input3" :disabled="true">
						</view>
						<text>+</text>
						<view class="list" style="background: #BDC3D3;color: #CECED0;">
							<input type="number" v-model="input4" :disabled="true">
						</view>
					</view>
				</view>
				<button type="default" class="button"
					@click="goodsChange=false,checkSafePasswordEmpty('goodsChange')">确认</button>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="show3" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="harvest">
				<view class="_view">
					<view class="title">
						挂卖
					</view>
					<view class="text">
						您今日未抢拍蜂巢或挂卖超出抢拍蜂巢数量，需<text>消耗一张金蜜券</text>挂卖，并在<text>次日</text>挂出。
					</view>
				</view>
				<view class="button2">
					<button type="default" class="b2" @click="toIndex">去抢拍</button>
					<button type="default" class="b1" @click="show3=false,seeCollectionPictures(id, json)">确认挂卖</button>
				</view>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="fenjie" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="harvest">
				<view class="_view">
					<view class="title">
						分解
					</view>
					<view class="text" style="padding: 0 70rpx;line-height: 1.5;">
						*蜂巢分解会分解为固定价值的蜂巢和金蜜 金蜜以<text style="color: #004FFF;">{{fenjieData.scale}}</text>倍返还
					</view>
					<view class="text"
						style="font-size: 30rpx;font-family: PingFang SC;font-weight: 500;color: #333333;">
						分解蜂巢价值
					</view>
				</view>
				<view class="input">
					<u-input :disabled="true" v-model="fenjieData.price" input-align="center"></u-input>
				</view>
				<view class="button2">
					<button type="default" class="b1"
						@click="fenjie=false,checkSafePasswordEmpty('fenjieGoods')">确认</button>
				</view>
				<view class="popup_top"></view>
			</view>
		</u-popup>
		<u-popup v-model="reminder" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="harvest">
				<view class="_view">
					<view class="title">
						挂卖确认
					</view>
					<view class="text">
						当前蜂巢可进行分解获取更高产出
					</view>
					<view class="text" style="color: #FB683D;margin-top: 10rpx;">
						挂卖之后操作不可逆，是否继续进行挂卖
					</view>
				</view>
				<view class="button2">
					<button type="default" class="b2" @click="reminder=false">分解蜂巢</button>
					<button type="default" class="b1" @click="reminder=false,getCode(id, json)">仍要挂卖</button>
				</view>
				<view class="popup_top"></view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				list1: [],
				offsetTop: 0,
				enable: true,
				code: false,
				addSite: false,
				logistics: false,
				site: false,
				harvest: false,
        award: false,
				pay: false,
				red: false,
				reminder: false,
				Hang: false,
				appeal: false,
				logisticsList: [],
				password: "",
				background: {
					'background': 'transparent'
				},
				title: "我的蜂巢",
				current: 0,
				list2: [{
						name: "当前持有"
					},
					{
						name: "待产出"
					},
					{
						name: "已产出"
					}
				],
				label: "请选择收货地址",
				value: "",
				page: 1,
				info: {},
				list: [],
				json: {
					price: 0,
					output: 0,
					title: ""
				},
				type: "",
				id: 0,
				banOnsale: [],
				use_gdbticket: 0,
				exchange: false,
				goodsChange: false,
				input1: 0,
				input2: 0,
				input3: 0,
				input4: 0,
				show3: false,
				checkboxList: [{
					type: 1,
					checked: true,
					disabled: false,
					name: "蜜贝",
					scale: 0
				}, {
					type: 2,
					checked: false,
					disabled: false,
					name: "金蜜",
					scale: 0
				}],
				radioCheckWidth: 'auto',
				radioCheckWrap: false,
				likeFruit: 1,
				fenjie: false,
				fenjieData: {}
			}

		},
		onLoad(option) {
			than = this;
			if (option.current) {
				than.current = parseInt(option.current)
			}
			/*
						than.post("api/order/messlist", null, function(data) {
							than.checkboxList[0].scale = data.kmb_scale
							than.checkboxList[1].scale = data.gdb_scale
						}) */
			than.post("api/order/currentAndExpect", null, function(data) {
				than.info = data
				/* if (data.hold_all == 0 && data.expect == 0) {
					than.toHint(1)
				} */
			})
			than.post("api/address/addressList", null, function(data) {
				var json = {
					value: data.default.address_id,
					label: data.default.region + data.default.detail
				}
				than.list1.push(json)
				for (let i in data.other) {
					var other = data.other[i]
					var json1 = {
						value: other.address_id,
						label: other.region + other.detail
					}
					than.list1.push(json1)
				}
			})
		},
		onShow() {
			switch (than.current) {
				case 0:
					than.producingList();
					break;
				case 1:
					than.producedList();
					break;
				case 2:
					than.finishList();
					break;
				default:
					break;
			}
		},
		onReachBottom() {
			than.page++
			switch (than.current) {
				case 0:
					than.producingList();
					break;
				case 1:
					than.producedList();
					break;
				case 2:
					than.finishList();
					break;
				default:
					break;
			}
		},
		methods: { // checkbox选择发生变化
			checkboxGroupChange(e) {
				this.likeFruit = e;
			},
			formatSeconds(value) {
				let result = parseInt(value)
				let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600);
				let m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result /
					60 % 60));
				let s = Math.floor((result % 60)) < 10 ? '0' + Math.floor((result % 60)) : Math.floor((result % 60));
				let res = '';
				if (h !== '00') res += `${h}：`;
				if (m !== '00') res += `${m}`;
				else res += '00';
				return res;
			},
			banOnsaleList() {
				than.red = true;
				than.post("api/order/banOnsaleList", null, function(data) {
					than.banOnsale = data;
				})
			},
			getreminder(index, item) {
				than.id = index
				than.json = item
				than.reminder = true
			},
			getHarvest(index, item) {
				than.id = index
				than.json = item
				than.harvest = true
			},
      /** 领奖
       */
      getAward() {
        than.post("api/order/receivePrice", {
          orderno: than.json.orderno,
          password: than.password
        }, function(data) {
          than.award = true
        })
      },
      /** 金蜜券挂卖
       */
      goldSale() {
        than.post("api/order/doSale", {
          use_gdbticket: '1',
          orderno: than.json.orderno,
          password: than.password
        }, function(data) {
          than.producedList();
          uni.showToast({
            title: data,
            icon: 'none',
            duration: 2000
          });
        })
      },
			getApplySplit(index, item) {
				than.id = index
				than.json = item
				than.checkSafePasswordEmpty('applySplit')
			},
			toIndex() {
				uni.switchTab({
					url: '/pages/home/index'
				})
			},
			getExchangeGoodsCash(index, item) {
				than.id = index
				than.json = item
				than.checkSafePasswordEmpty('exchangeGoodsCash')
			},
			getfenjieGoods(index, item) {
				than.id = index
				than.json = item
				than.post("api/order/fehjieAlert", {
					orderno: than.json.orderno
				}, function(data) {
					than.fenjieData = data
					than.fenjie = true;
				})
			},
			getLogistics(index, item) {
				than.id = index;
				than.post("api/order/logistics", {
					orderno: item.orderno
				}, function(data) {
					than.logistics = true;
					than.logisticsList = data;
				})
			},
			abc() {
				if (than.list1.length == 0) {
					than.toast("您还未上传收货地址请到个人中心-地址管理上传收货地址在进行操作")
					return false
				}
				than.site = true
			},
			getCodeInitial(index, item) {
				than.seeCollectionPictures(index, item)
			},
			getExchange(index, item) {
				than.id = index
				than.json = item
				var x = than.mul(than.json.price, than.json.reduce_split_scale)
				than.input1 = x
				than.input2 = than.sub(than.json.price, x)
				than.exchange = true;
			},
			getChange(index, item) {
				than.id = index
				than.json = item
				var x = than.mul(than.json.price, than.json.reduce_dismantling_scale)
				than.input3 = x
				than.input4 = than.sub(than.json.price, x)
				than.goodsChange = true;
			},
			getCode(index, item) {
				//buy_count: 0买
				//gdbticket_count: 0金蜜券
				//sale_count: 0卖
				than.post("api/order/doSaleStatus", {
					orderno: item.orderno
				}, function(data) {
					if (parseInt(data.buy_count) > parseInt(data.sale_count)) {
						than.seeCollectionPictures(index, item)
					} else {
						if (parseInt(data.gdbticket_count) > 0) {
							than.show3 = true;
							than.use_gdbticket = 1;
							than.id = index
							than.json = item
						} else {
							than.toast("抢拍数量不足或金蜜券数量不足不能挂卖")
						}
					}

				})
			},
			seeCollectionPictures(index, item) {
				than.post("api/center/seeCollectionPictures", null, function(data) {
					if (data.length == 0) {
						than.code = true;
					} else {
						than.id = index
						than.json = item
						than.Hang = true;
					}
				})
			},
			seePingZeng(index) {
				than.id = index;
				if (than.list[than.id].trade_status == 1) {
					/* 		than.toPage('/pages/htmlB/voucher/voucher?type=2&orderno=' + than.list[than.id].orderno)
					 */
				} else {
					than.toast("未上传凭证")
				}
			},
			checkSafePasswordEmpty(text,item,type) {
				than.type = text
        if(type === 1) than.json = item
				than.post("api/member/checkSafePasswordEmpty", null, function(data) {
					if (parseInt(data) == 0) {
						than.toast("未设置二级密码")
						uni.navigateTo({
							url: "/pages/htmlA/setting/twopassword"
						})
					} else {
						than.pay = true;
					}
				})
			},
			producingList() {
				than.post("api/order/producingList", {
					page: than.page
				}, function(data) {
					for (let i in data) {
						data[i].show = true
					}
					if (than.page == 1) {
						than.list = data;
					} else {
						than.list = than.list.concat(data)
					}
				})
			},
			producedList() {
				than.post("api/order/producedList", {
					page: than.page
				}, function(data) {
					for (let i in data) {
						data[i].show = true
					}
					if (than.page == 1) {
						than.list = data;
					} else {
						than.list = than.list.concat(data)
					}
				})
			},
			finishList() {
				than.post("api/order/finishList", {
					page: than.page
				}, function(data) {
					for (let i in data) {
						data[i].show = true
						switch (data[i].type) {
							case 'TAKE_DELIVERY_AUTO':
								data[i].text = "自动收获"
								break;
							case 'TAKE_DELIVERY_MANUAL':
								data[i].text = "已收获"
								break;
							case 'ONSALE':
								data[i].text = "已挂卖"
								break;
							case 'SELL_OUT':
								data[i].text = "已卖出"
								break;
							case 'APPEALING':
								data[i].text = "申诉中"
								break;
							case 'GAMEOVER':
								data[i].text = "发货完成"
								break;
							case 'APPLY_SPLIT':
								data[i].text = "拆分审核"
								break;
							case 'FINISH_SPLIT':
								data[i].text = "已拆分"
								break;
							case 'FINISH_SPLIT_ADMIN':
								data[i].text = "已拆分"
								break;
							case 'EXCHANGED':
								data[i].text = "金蛋"
								break;
							default:
								break;
						}
					}
					if (than.page == 1) {
						than.list = data;
					} else {
						than.list = than.list.concat(data)
					}
				})
			},
			change(e) {
				than.page = 1;
				than.current = e;
				switch (e) {
					case 0:
						than.producingList();
						break;
					case 1:
						than.producedList();
						break;
					case 2:
						than.finishList();
						break;
					default:
						break;
				}
			},
			doSale() {
				than.post("api/order/doSale", {
					orderno: than.json.orderno,
					password: than.password,
					use_gdbticket: than.use_gdbticket
				}, function(data) {
					than.Hang = false;
					than.list[than.id].show = false;
					than.password = "";
					than.toast('挂卖' + data)
				})
			},
			getharvest() {
				if (!than.value) {
					than.toast("未选择地址")
					return false
				}
				than.post("api/order/harvest", {
					orderno: than.json.orderno,
					address_id: than.value,
					password: than.password
				}, function(data) {
					than.harvest = false;
					than.password = "";
					than.list[than.id].show = false;
					than.toast('收获' + data)
				})
			},
			appealPost() {
				than.post("api/order/appeal", {
					orderno: than.json.orderno,
					password: than.password
				}, function(data) {
					than.addSite = false;
					than.password = "";
					than.toast(data)
				})
			},
			applySplit() {
				than.post("api/order/applySplit", {
					orderno: than.json.orderno,
					password: than.password
				}, function(data) {
					than.list[than.id].show = false;
					than.password = "";
					than.toast('拆分' + data)
				})
			},
			fenjieGoods() {
				than.post("api/order/fenjieGoods", {
					orderno: than.json.orderno,
					password: than.password
				}, function(data) {
					than.list[than.id].show = false;
					than.password = "";
					than.toast(data)
				})
			},
			appendAddress() {
				if (!than.value) {
					than.toast("未选择地址")
					return false
				}
				than.post("api/order/appendAddress", {
					orderno: than.json.orderno,
					address_id: than.value,
					password: than.password
				}, function(data) {
					than.addSite = false;
					than.list[than.id].type = 'TAKE_DELIVERY_MANUAL';
					than.password = "";
					than.toast(data)
				})
			},
			confirm(e) {
				than.label = e[0].label
				than.value = e[0].value
			},
			exchangeGoodsCash() {
				than.post("api/order/exchangeGoodsCash", {
					orderno: than.json.orderno,
					password: than.password
				}, function(data) {
					than.list[than.id].show = false;
					than.password = "";
					than.toast(data + "转入金蛋")
				})
			},
			toExchange() {
				var add = than.add(than.input1, than.input2)
				if (than.sub(add, than.json.price) != 0) {
					than.toast('拆分价值必须等于当前蜂巢价值');
				} else {
					if (than.input1 >= 50 && than.input2 >= 50) {
						than.post("api/order/exchange", {
							orderno: than.json.orderno,
							password: than.password,
							arr: [than.input1, than.input2]
						}, function(data) {
							than.list[than.id].show = false;
							than.password = "";
							than.toast('拆分' + data)
						})
					} else {
						than.toast('拆分价值不能小于50');
					}
				}
			},
			toGoodsChange() {
				var add = than.add(than.input3, than.input4)
				if (than.sub(add, than.json.price) != 0) {
					than.toast('拆解价值必须等于当前蜂巢价值');
				} else {
					if (than.input3 >= 50 && than.input4 >= 1) {
						than.post("api/order/goodsChange", {
							orderno: than.json.orderno,
							password: than.password,
							type: than.likeFruit,
							value: than.input3
						}, function(data) {
							than.list[than.id].show = false;
							than.password = "";
							than.toast('拆解' + data)
						})
					} else {
						than.toast('拆解价值不能小于50');
					}
				}
			},
			onChange(val) {
				if (this.password.length < 6) {
					this.password += val;
				}

				if (this.password.length >= 6) {
					switch (than.type) {
						case 'doSale':
							than.doSale();
							break;
						case 'getharvest':
							than.getharvest();
							break;
						case 'appendAddress':
							than.appendAddress();
							break;
						case 'appeal':
							than.appealPost();
							break;
						case 'applySplit':
							than.applySplit();
							break;
						case 'exchangeGoodsCash':
							than.exchangeGoodsCash();
							break;
						case 'exchange':
							than.toExchange();
							break;
						case 'goodsChange':
							than.toGoodsChange();
							break;
						case 'fenjieGoods':
							than.fenjieGoods();
							break;
            case 'reward':
              than.getAward();
              break;
            case 'goldSale':
              than.goldSale();
              break;
						default:
							break;
					}
					than.pay = false;
					this.password = ""
				}
			},
			onBackspace(e) {
				if (this.password.length > 0) {
					this.password = this.password.substring(0, this.password.length - 1);
				}
			}
		}
	}
</script>

<style lang="less">
	.fruits {
		width: 131rpx;
		height: 151rpx;
		position: fixed;
		left: 23rpx;
		bottom: 44rpx;
	}

	.menu {
		height: 98rpx;
		display: flex;
		align-items: center;

		.right {

			margin-left: auto;
			display: flex;
			align-items: center;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #848484;

			image {
				margin-left: 14rpx;
				width: 28rpx;
				height: 28rpx;
			}
		}
	}

	.hint {
		height: 100%;
		position: fixed;
		width: 100%;

		image {
			width: 100%;
		}
	}

	.popup {
		text-align: center;

		.popup_top {
			height: 30rpx;
		}

		._view {
			background: #FFFFFF;
			margin: 0 30rpx 30rpx;
			padding-bottom: 20rpx;

			.title {
				height: 111rpx;
				line-height: 111rpx;
				text-align: center;
				border-bottom: 2rpx solid #F6F6F6;
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
			}

			.code {
				text-align: center;

				image {
					width: 81rpx;
					height: 81rpx;
				}
			}

			.cont {
				margin-top: 20rpx;
				height: 150rpx;
				text-align: center;
				font-size: 28rpx;
				color: #333333;

				.name {
					margin: 0 90rpx;
				}

				.text {
					display: flex;
					align-items: center;
					justify-content: center;
					color: #F46813;
					font-size: 28rpx;

					text {
						margin: 0 10rpx;
						font-size: 48rpx;
					}
				}
			}
		}

		.button {
			border-radius: 20rpx;
			border: 0;
			width: 314rpx;
			height: 80rpx;
			color: #FFFFFF;
			background: #FB683D;
		}
	}



	.logistics {
		text-align: center;

		.popup_top {
			height: 30rpx;border: 1px solid red;
		}

		._view {
			background: #FFFFFF;
			margin: 0 30rpx 30rpx;
			padding-bottom: 20rpx;

			.title {
				height: 111rpx;
				line-height: 111rpx;
				text-align: center;
				border-bottom: 2rpx solid #F6F6F6;
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
			}

			.appeal {
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #666666;
			}

			.logistics-content {
				padding: 94rpx 39rpx 40rpx;

				.list {
					display: flex;
					align-items: center;
					height: 175rpx;
					background: #F5F5F5;
					border-radius: 10rpx;
					margin-bottom: 15rpx;

					.icon {
						width: 20rpx;
						height: 20rpx;
						margin: auto 20rpx;
						background: #FB683D;
						border-radius: 10rpx;
					}

					.right {
						text-align: left;

						view {
							height: 45rpx;
						}
					}
				}
			}
		}

		.button {
			margin: 36rpx auto 0;
			width: 245rpx;
			height: 74rpx;
			background: #FB683D;
			border-radius: 20rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			box-shadow: 0px 6rpx 8rpx 0px rgba(170, 170, 170, 0.16);
			line-height: 80rpx;
		}
	}

	.harvest {
		text-align: center;

		.popup_top {
			height: 30rpx;
		}

		.input {
			margin: auto;
			width: 206rpx;
			height: 100rpx;
			background: #FDF4ED;
			border: 1rpx solid #FB683D;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		._view {
			background: #FFFFFF;
			margin: 0 30rpx 30rpx;
			padding-bottom: 20rpx;

      .reward-Star {
        width: 100%;
        text-align: center;
        .img {
          width: 426rpx;
          height: 391rpx;
          margin-bottom: -120rpx;
        }
        .text {
          color: #666666;
          font-size: 28rpx;
          text-align: center;
          .number {
            color: #FB683D;
            font-size: 64rpx;
            text-align: center;
          }
        }
      }

			.title {
				height: 111rpx;
				line-height: 111rpx;
				text-align: center;
				border-bottom: 2rpx solid #F6F6F6;
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
			}

			.text {
				margin-top: 62rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #666666;
				line-height: 1;

				text {
					color: #FB683D;
				}
			}

			.date {
				margin-bottom: 29rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #666666;
			}

			.number {
				font-size: 48rpx;
				font-weight: bold;
				color: #FB683D;
				font-style: initial;
				margin-top: 21rpx;
				margin-bottom: 60rpx;

				text {
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: bold;
				}
			}

			.select {
				width: 413rpx;
				height: 100rpx;
				line-height: 1;
				background: #FDF4ED;
				border: 1px solid #FB683D;
				border-radius: 20rpx;
				margin: auto;
				display: flex;
				align-items: center;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #666666;

				.da {
					padding: 0 40rpx;
				}

				.xiao {
					margin-left: auto;
					margin-right: 41rpx;
				}
			}
		}

		.button2 {
			display: flex;
			align-items: center;
			justify-content: center;

			.b1 {
				margin: 71rpx auto 0;
				width: 245rpx;
				height: 74rpx;
				background: #FB683D;
				border-radius: 20rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
				line-height: 74rpx;
			}

			.b2 {
				margin: 71rpx auto 0;
				width: 245rpx;
				height: 74rpx;
				background: #FFFFFF;
				border-radius: 20rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #FB683D;
				border: 1px solid #FB683D;
				line-height: 74rpx;
			}
		}

		.button {
			margin: 71rpx auto 0;
			width: 245rpx;
			height: 74rpx;
			background: #FB683D;
			border-radius: 20rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			line-height: 74rpx;
		}

	}

	.content {
		padding: 50rpx 36rpx 0;

		.list {
			border-radius: 20rpx;
			background: #FFFFFF;
			margin-bottom: 24rpx;

			.title {
				height: 88rpx;
				border-bottom: 1px solid #F7F7F7;
				padding: 0 27rpx;
				display: flex;
				align-items: center;

				.left {
					display: flex;
					align-items: center;
					background: #F4F5F7;
					border-radius: 29rpx;
					height: 58rpx;
					padding: 0 20rpx 0 8rpx;

					image {
						width: 42rpx;
						height: 42rpx;
					}

					.name {
						margin-left: 11rpx;
						font-size: 30rpx;
						font-weight: bold;
					}
				}

				.id {
					display: flex;
					align-items: center;
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #4A5062;
					margin-left: auto;

					.icon {
						margin-right: 5rpx;
						width: 30rpx;
						height: 24rpx;
						background: #FEC31D;
						border-radius: 4rpx;
						font-size: 18rpx;
						font-weight: 500;
						color: #FFFFFF;
						text-align: center;
						line-height: 24rpx;
					}
				}
			}

			.up {
				display: flex;
				height: 220rpx;
				align-items: center;
				padding: 0 26rpx;

				.left {
					width: 380rpx;
					height: 181rpx;
					margin-left: auto;
					background: #F7F8FD;
					border-radius: 10rpx;
					padding-left: 18rpx;

					.auto {
						height: 55rpx;
						display: flex;
						align-items: center;

						.img {
							width: 26rpx;
							height: 26rpx;
							margin-right: 17rpx;
						}

						.name {
							font-size: 30rpx;
							font-weight: bold;
							color: #666666;
							margin-right: 17rpx;
						}

						.text {

							font-size: 32rpx;
							font-weight: bold;
							color: #333333;

							text {
								font-size: 28rpx;
							}
						}

						.time {
							font-size: 28rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #999999;
						}
					}
				}

				.right {
					text-align: center;
					width: 230rpx;
					height: 181rpx;
					background: #FDF4ED;
					border-radius: 10rpx;

					.number {
						margin-top: 30rpx;
						font-size: 48rpx;
						font-weight: bold;
						color: #F66337;
						font-style: initial;

						text {
							font-size: 28rpx;
						}
					}

					.name {
						margin-top: 15rpx;
						font-size: 26rpx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #1B1B1B;
					}
				}
			}

			.down {
				display: flex;
				align-items: center;
				padding: 0 24rpx;

				button {

					image {
						width: 36rpx;
						height: 36rpx;
						margin-right: 13rpx;
					}

					display: flex;
					align-items: center;
					justify-content: center;
					background: #FFFFFF;
					border: 1rpx solid #C7C7C7;
					border-radius: 30rpx;
					height: 60rpx;
					line-height: 60rpx;
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #666666;
					margin-right: 0;
					margin-bottom: 20rpx;
				}
			}
		}


	}

	page {
		background: #FAFAFA;
	}

	.top {
		background: #FFFFFF;
		height: 300rpx;


		.up {
			position: relative;
			height: 234rpx;
			display: flex;
			align-items: center;
			justify-content: center;


			.l1 {
				background-image: url(../static/z1.png);
				margin-right: 12rpx;

				.number {

					color: #205FFA;
				}
			}

			.l2 {
				margin-left: 12rpx;
				background-image: url(../static/z2.png);

				.number {
					color: #FB683D;
				}
			}

			.list {
				width: 327rpx;
				height: 232rpx;
				text-align: center;
				background-size: 100% 100%;

				image {
					width: 102rpx;
					height: 102rpx;
				}

				.name {
					font-size: 32rpx;
					font-weight: bold;
				}

				.number {

					font-size: 60rpx;
					font-family: Myriad Pro;
					font-weight: bold;
				}
			}
		}

		.down {
			height: 100rpx;
			background: #FFFFFF;
			border-radius: 40rpx 40rpx 0px 0px;
		}
	}
</style>
